# 数据库参数
DATABASE_CONFIG = {
    "ecu_test_mysql":
        {
            "host": "10.100.73.74",
            "port": 3306,
            "user": "ttyc_57",
            "password": "OClgaa6YD!Rylnb5",
            "db": "test_iot"
        }
}

# 当前支持的sso账户
ECU_TEST_ACCOUNT = ["xingfengye"]

# 当前支持邮件发送的账户
SEND_MAIL_ACCOUNT = ["lidongwei", "liuzichen"]

# 邮件发送配置
EMAIL_TO = ["lidongwei"]

# 钉钉群智能助手链接
NOTIFY_DICT = {
            "iot_group": "https://oapi.dingtalk.com/robot/send?access_token=5098aed0336681080a62bec0efb6fff2e68b7b6dc7b2561bc7c5ad2a12202d91",
             "try_try": "https://oapi.dingtalk.com/robot/send?access_token=9c58282f38270b47edc76c1d389d0ad80a9e132cc7711f5526af2e52b122e19a",
             "ecu_test": "https://oapi.dingtalk.com/robot/send?access_token=e5188c4ff20f8b7d015691437fe09bc35764f7be39b6effee14127b7980eb999",
             "auto_test": "https://oapi.dingtalk.com/robot/send?access_token=fa0c8eac989253bb196134f7ca164fb6d5e99cb195b383a8f4507b306aefa7ad"
        }

# 测试环境城市
CITY_DICT_TEST = {
    "朝阳区": 73,"合肥工厂": 749
}

# 线上城市
REGION_ID_DICT_ONLINE = {
    '宿州市': 4723,
    '金寨县': 4737,
    '聊城市': 5129,
    '牡丹区': 5150,
    '淅川县': 5299,
    '邓州市': 5304,
    '祁东县': 5525,
    '江华瑶族自治县': 5603,
    '江永县': 5599,
    '会东县': 6217,
    '纳雍县': 6278,
    '麒麟区': 6351,
    '景洪市': 6455,
    '江苏邳州经济开发区': 181314,
    '西华师范大学(华凤校区)': 712106
}

# 车辆存储状态
STORAGE_STATUS = {
    "全部": "",          # 表示所有状态的标识
    "入库": 1,          # 表示入库状态
    "投放": 2,          # 表示投放状态
    "回收": 3,          # 表示回收状态
    "报废": 4,          # 表示报废状态
    "已返厂": 7,        # 表示已返厂状态
    "资产被盗": 8,      # 表示资产被盗状态
    "资产丢失": 9,      # 表示资产丢失状态
    "调拨入库": 10      # 表示调拨入库状态
}

ONLINE_STATUS = {
    "全部": "",         # 表示所有状态
    "在线": "true",    # 表示在线状态
    "离线": "false"    # 表示离线状态
}

# 车辆状态
BIKE_INTFO = {
    "usage_status": ["借车", "还车", "撤防"],
    "acc_status": ["断电","供电"],
    "riding_status": ["非骑行","骑行"],
    "motion_status": ["静止","运动"]
}

# 头盔在位状态
HELMET_EXIST_STATUS = {
    "IN_POSITION": "在位",
    "NOT_IN_POSITION": "不在位",
    "UNKNOWN": "未知"
}

# 头盔锁状态
HELMET_LOCK_STATUS = {
    "UNLOCKED": "开锁",
    "LOCKED": "加锁",
    "UNKNOWN": None,
    "RESERVED": "未定义"
}

# 头盔佩戴状态
HELMET_WEAR_STATUS = {
    "UNSUPPORTED": "不支持佩戴检测",
    "WORE": "已佩戴",
    "NOT_WORE": "未佩戴",
    "UNKNOWN": "未知"
}

# 升级任务状态
OTA_TASK_STATUS = {
    "异常终止": "ERROR_END",
    "执行中": "EXECUTING",
    "终止": "END",
    "关闭": "CLOSE"
}

# ECU指令含义对照表
COMMAND_DICT_LIST = [{"command_type":"OPEN","command_code":"301","command_note":"开锁"},
                     {"command_type":"CANCEL_DEFENCE","command_code":"302","command_note":"撤防（acc断电，后轮锁开启）"},
                     {"command_type":"CLOSE","command_code":"304","command_note":"关锁（acc断电,后轮锁关闭）"},
                     {"command_type":"OPEN_BATTERY_LOCK","command_code":"305","command_note":"打开电池锁"},
                     {"command_type":"CLOSE_BATTERY_LOCK","command_code":"306","command_note":"关闭电池锁"},
                     {"command_type":"FIND","command_code":"307","command_note":"寻车铃声"},
                     {"command_type":"RESTART","command_code":"312","command_note":"重启"},
                     {"command_type":"RESET","command_code":"314","command_note":"恢复出厂设置"},
                     {"command_type": "UPLOAD_GPS_PACKAGE","command_code": "317", "command_note":"上报gps包"},
                     {"command_type": "UPLOAD_BATTERY_PACKAGE","command_code": "322", "command_note": "上报电池包"},
                     {"command_type": "UPLOAD_ALARM_PACKAGE","command_code": "323", "command_note": "上报告警包"},
                     {"command_type": "QUERY_PARAM", "command_code": "330", "command_note":"参数查询"},
                     {"command_type": "SET_STATUS", "command_code": "331", "command_note": "参数设置"},
                     {"command_type": "ENABLE_USB", "command_code": "341", "command_note": "打开外部USB供电"},
                     {"command_type": "DISABLE_USB", "command_code": "342", "command_note": "关闭外部USB供电"},
                     {"command_type": "OPEN_WHEEL_LOCK", "command_code": "343", "command_note": "打开轮毂锁"},
                     {"command_type": "CLOSE_WHEEL_LOCK", "command_code": "344", "command_note": "关闭轮毂锁"},
                     {"command_type": "OPEN_HELMET_LOCK", "command_code": "345", "command_note": "开头盔锁"},
                     {"command_type": "CLOSE_HELMET_LOCK", "command_code": "346", "command_note": "关头盔锁"},
                     {"command_type": "OPEN_HELMET_LOCK_AUTO_RETURN", "command_code": "347", "command_note": "开头盔锁自动回位"},
                     {"command_type": "GET_BLUETOOTH_STATION", "command_code": "350", "command_note": "获取蓝牙车站信息"},
                     {"command_type": "BLE_TOKEN_RESET_MANDATORY", "command_code": "351", "command_note": "强制重置蓝牙密码"},
                     {"command_type": "BLE_TOKEN_RESET", "command_code": "352", "command_note": "重置蓝牙密码"},
                     {"command_type": "ADD_VOICE", "command_code": "353", "command_note": "增加语音数据"},
                     {"command_type": "DELETE_VOICE", "command_code": "354", "command_note": "删除语音数据"},
                     {"command_type": "QUERY_VOICE", "command_code": "355", "command_note": "查询语音数据"},
                     {"command_type": "CHECK_VOICE_HORN", "command_code": "356", "command_note": "语音喇叭检测"},
                     {"command_type": "CANCEL_DEFENCE_VOICE", "command_code": "357", "command_note": "撤防指令（先播语音再执行撤防动作)"},
                     {"command_type": "CANCEL_DEFENCE_NOVOICE", "command_code": "358", "command_note": "撤防指令（忽略语音，立即执行）"},
                     {"command_type": "FIND_VOICE", "command_code": "359", "command_note": "寻车指令-执行声音寻车"},
                     {"command_type": "FIND_LIGTH", "command_code": "360", "command_note": "寻车指令-执行灯光寻车"},
                     {"command_type": "FIND_VOICE_LIGTH", "command_code": "361", "command_note": "寻车指令-执行声音+灯光寻车"},
                     {"command_type": "BIKE_CLOSE_SECURITY", "command_code": "362", "command_note": "安全关锁指令"},
                     {"command_type": "SYSTEM_CALIBRATION_CLEAR", "command_code": "363", "command_note": "系统标定指令-清除标定信息"},
                     {"command_type": "SYSTEM_CALIBRATION_ZERO", "command_code": "364", "command_note": "系统标定指令-零点标定"},
                     {"command_type": "SYSTEM_CALIBRATION_LOAD_MULTIPOINT", "command_code": "365", "command_note": "系统标定指令-多点加载标定"},
                     {"command_type": "SYSTEM_CALIBRATION_SET_ZERO", "command_code": "366", "command_note": "系统标定指令-置零"},
                     {"command_type": "OTA", "command_code": "367", "command_note": "远程升级指令(OTA)"},
                     {"command_type": "ECU_LOG_INSTRUCTION_HISTORY", "command_code": "368", "command_note": "ECU日志指令-上报历史日志"},
                     {"command_type": "ECU_LOG_INSTRUCTION_REALTIME_START", "command_code": "369", "command_note": "ECU日志指令-开始上报实时日志"},
                     {"command_type": "ECU_LOG_INSTRUCTION_REALTIME_END", "command_code": "370", "command_note": "ECU日志指令-停止上报实时日志"},
                     {"command_type": "TAIL_LIGHT", "command_code": "371", "command_note": "车灯控制指令"},
                     {"command_type": "OPEN_BATTERY_LOCK_AUTO_RETURN", "command_code": "372", "command_note": "开电池锁自动回位指令"},
                     {"command_type": "CANCEL_DEFENCE_SAF", "command_code": "373", "command_note": "安全撤防"},
                     {"command_type": "SMART_HELMET_UNLOCK ", "command_code": "374", "command_note": "头盔车辆开启"},
                     {"command_type": "SMART_HELMET_LOCK", "command_code": "375", "command_note": "头盔车辆关闭"},
                     {"command_type": "HELMET_BORROW", "command_code": "376", "command_note": "头盔借用"},
                     {"command_type": "HELMET_RETURN", "command_code": "377", "command_note": "头盔归还"} ]

# 时间线相关
TIME_LINETYPE_DICT = {
    "指令下发": 10,
    "指令结果": 20,
    "蓝牙指令结果": 21,
    "上报": 30,
    "消息下发到ecu状态": 40,
    "车辆上下线消息": 50,
    "车辆操作信息": 60,
    "通用数据请求": 100
}
CMD_DICT = {
    "登陆包": 1,
    "定位包": 2,
    "电池包": 3,
    "报警包": 4,
    "心跳包": 5,
    "远程控制报文": 6,
    "远程查询参数": 7,
    "远程设置": 8,
    "短信上报报文": 10,
    "远程语音播报": 12,
    "语音数据编号同步": 14,
    "文件链接获取": 15,
    "车辆信息包": 17,
    "蓝牙密码重置报文": 18,
    "OTA状态上报报文": 20,
    "state": {
        "0x01": "固件数据开始下载",
        "0x02": "固件数据下载完成",
        "0x03": "固件数据下载失败",
        "0x04": "固件数据写入完成",
        "0x05": "固件数据校验失败",
        "0x06": "不支持的固件类型"
    },

    "增加语音数据报文": 21,
    "删除语音数据报文": 22,
    "查询语音列表报文": 23,
    "远程升级指令报文": 24,
    "头盔锁指令报文": 26,
    "RTK数据推送": 30,
    "RTK数据请求": 31,
    "重量包": 32,
    "ECU日志上报": 33,
    "蓝牙信息上报": 34,
    "车辆开启指令": 49,
    "车辆撤防指令": 50,
    "车辆关闭": 52,
    "开电池锁指令": 53,
    "声光寻车指令": 55,
    "语音喇叭检测": 56,
    "系统标定指令报文": 57,
    "STE日志指令报文": 58,
    "车灯控制指令": 59
}
RTK_TYPE_DICT = {
    "一键还车V2": 2052,
    "停车点": 2050
}
